local skel = fk.CreateSkill {
  name = "emo__zhuigong",
}

Fk:loadTranslationTable{
  ["emo__zhuigong"] = "追攻",
  [":emo__zhuigong"] = "出牌阶段限两次， 你可将手牌数调整至与一名其他角色相同，若你因此：失去牌，你视为对其使用一张冰【杀】；获得牌，该角色视为对你使用一张冰【杀】。",

  ["#emo__zhuigong"] = "追攻：将手牌数调整至与一名其他角色相同",
}

skel:addEffect("active", {
  anim_type = "drawcard",
  prompt = "#emo__zhuigong",
  card_num = 0,
  target_num = 1,
  can_use = function (self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) < 2
  end,
  target_filter = function (self, player, to_select, selected)
    return #selected == 0 and to_select:getHandcardNum() ~= player:getHandcardNum()
  end,
  times = function (self, player)
    return 2 - player:usedSkillTimes(skel.name, Player.HistoryPhase)
  end,
  on_use = function (self, room, skillUseEvent)
    local player, to = skillUseEvent.from, skillUseEvent.tos[1]
    local x = player:getHandcardNum() - to:getHandcardNum()
    if x > 0 then
      room:askToDiscard(player, {min_num = x, max_num = x, include_equip = false, skill_name = skel.name, cancelable = false})
    elseif x < 0 then
      player:drawCards(-x, skel.name)
      player, to = to, player
    else
      return
    end
    if not to.dead and not player.dead then
      room:useVirtualCard("ice__slash", nil, player, to, skel.name, true)
    end
  end,
})

return skel
